// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#include <QApplication>
#include <QFile> // 添加QFile头文件
#include "mainwindow.h"

//! [0]
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    MainWindow window;
    window.show();

    // 处理命令行参数
    if (argc > 1) {
        QString fileName = QString::fromLocal8Bit(argv[1]);
        if (QFile::exists(fileName)) // 现在QFile已正确声明
            window.openFile(fileName);
    }

    return app.exec();
}
//! [0]
